
<!DOCTYPE html>
<html lang="sv">
<head>
    <meta charset="utf-8" />
    <title>Iframe height demo</title>
    <style media="screen,print">
        #body {
            width:70em;
            max-width:100%;
            margin:0 auto;
        }
        iframe {
            width:100%;
            margin:0 0 1em;
            border:0;
        }
    </style>
    <script language="javascript">
        function iframeAutoFit(iframeObj){
            setTimeout(function(){if(!iframeObj) return;iframeObj.height=(iframeObj.Document?iframeObj.Document.body.scrollHeight:iframeObj.contentDocument.body.offsetHeight); console.log("test")},200)
        }
        window.onload = function () {
            iframeAutoFit(document.getElementById('test'));
        };
    </script>
</head>
<body>
<div id="body">
    <h1>Iframe height demo</h1>
    <h2><code>iframe</code> <strong>without</strong> height adjustment</h2>
    <iframe src="back.html"></iframe>
    <h2><code>iframe</code> <strong>with</strong> height adjustment</h2>
    <iframe src="back.html" frameborder="0" scrolling="no" id="test"></iframe>
    <iframe src="http://caibaojian.com/javascript-module-2.html" frameborder="0" scrolling="no" id="blog" sandbox="allow-same-origin"></iframe>
    <div id="labfooter">
    </div>
</div>
</body>
</html>